home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Printing.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  14.0 KB  |  455 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Printing.h
  3.  
  4.      Contains:    Print Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __PRINTING__
  18. #define __PRINTING__
  19.  
  20. #ifndef __ERRORS__
  21. #include <Errors.h>
  22. #endif
  23. #ifndef __QUICKDRAW__
  24. #include <Quickdraw.h>
  25. #endif
  26. #ifndef __DIALOGS__
  27. #include <Dialogs.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52.  
  53. enum {
  54.     iPFMaxPgs                    = 128,
  55.     iPrPgFract                    = 120,                            /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  56.     iPrPgFst                    = 1,                            /*Page range constants*/
  57.     iPrPgMax                    = 9999,
  58.     iPrRelease                    = 3,                            /*Current version number of the code.*/
  59.     iPrSavPFil                    = -1,
  60.     iPrAbort                    = 0x0080,
  61.     iPrDevCtl                    = 7,                            /*The PrDevCtl Proc's ctl number*/
  62.     lPrReset                    = 0x00010000,                    /*The PrDevCtl Proc's CParam for reset*/
  63.     lPrLineFeed                    = 0x00030000,
  64.     lPrLFStd                    = 0x0003FFFF,                    /*The PrDevCtl Proc's CParam for std paper advance*/
  65.     lPrLFSixth                    = 0x0003FFFF,
  66.     lPrPageEnd                    = 0x00020000,                    /*The PrDevCtl Proc's CParam for end page*/
  67.     lPrDocOpen                    = 0x00010000,
  68.     lPrPageOpen                    = 0x00040000,
  69.     lPrPageClose                = 0x00020000,
  70.     lPrDocClose                    = 0x00050000,
  71.     iFMgrCtl                    = 8,                            /*The FMgr's Tail-hook Proc's ctl number*/
  72.     iMscCtl                        = 9,                            /*The FMgr's Tail-hook Proc's ctl number*/
  73.     iPvtCtl                        = 10                            /*The FMgr's Tail-hook Proc's ctl number*/
  74. };
  75.  
  76. #define sPrDrvr ".Print"
  77. /*    Error Codes moved to Errors.(hap) */
  78.  
  79. enum {
  80.     pPrGlobals                    = 0x00000944,                    /*The PrVars lo mem area:*/
  81.     bDraftLoop                    = 0,
  82.     bSpoolLoop                    = 1,
  83.     bUser1Loop                    = 2,
  84.     bUser2Loop                    = 3,
  85.     fNewRunBit                    = 2,
  86.     fHiResOK                    = 3,
  87.     fWeOpenedRF                    = 4,                            /*Driver constants */
  88.     iPrBitsCtl                    = 4,
  89.     lScreenBits                    = 0,
  90.     lPaintBits                    = 1,
  91.     lHiScreenBits                = 0x00000002,                    /*The Bitmap Print Proc's Screen Bitmap param*/
  92.     lHiPaintBits                = 0x00000003,                    /*The Bitmap Print Proc's Paint [sq pix] param*/
  93.     iPrIOCtl                    = 5,
  94.     iPrEvtCtl                    = 6,                            /*The PrEvent Proc's ctl number*/
  95.     lPrEvtAll                    = 0x0002FFFD,                    /*The PrEvent Proc's CParam for the entire screen*/
  96.     lPrEvtTop                    = 0x0001FFFD,                    /*The PrEvent Proc's CParam for the top folder*/
  97.     iPrDrvrRef                    = -3
  98. };
  99.  
  100.  
  101. enum {
  102.     getRslDataOp                = 4,
  103.     setRslOp                    = 5,
  104.     draftBitsOp                    = 6,
  105.     noDraftBitsOp                = 7,
  106.     getRotnOp                    = 8,
  107.     NoSuchRsl                    = 1,
  108.     OpNotImpl                    = 2,                            /*the driver doesn't support this opcode*/
  109.     RgType1                        = 1
  110. };
  111.  
  112.  
  113. enum {
  114.     feedCut                        = 0,
  115.     feedFanfold                    = 1,
  116.     feedMechCut                    = 2,
  117.     feedOther                    = 3
  118. };
  119.  
  120. typedef SInt8                             TFeed;
  121.  
  122. enum {
  123.     scanTB                        = 0,
  124.     scanBT                        = 1,
  125.     scanLR                        = 2,
  126.     scanRL                        = 3
  127. };
  128.  
  129. typedef SInt8                             TScan;
  130. /* A Rect Ptr */
  131. typedef Rect *                            TPRect;
  132. typedef CALLBACK_API( void , PrIdleProcPtr )(void );
  133. typedef CALLBACK_API( void , PItemProcPtr )(DialogPtr theDialog, short item);
  134. typedef STACK_UPP_TYPE(PrIdleProcPtr)                             PrIdleUPP;
  135. typedef STACK_UPP_TYPE(PItemProcPtr)                             PItemUPP;
  136. enum { uppPrIdleProcInfo = 0x00000000 };                         /* pascal no_return_value Func() */
  137. enum { uppPItemProcInfo = 0x000002C0 };                         /* pascal no_return_value Func(4_bytes, 2_bytes) */
  138. #define NewPrIdleProc(userRoutine)                                 (PrIdleUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPrIdleProcInfo, GetCurrentArchitecture())
  139. #define NewPItemProc(userRoutine)                                 (PItemUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPItemProcInfo, GetCurrentArchitecture())
  140. #define CallPrIdleProc(userRoutine)                             CALL_ZERO_PARAMETER_UPP((userRoutine), uppPrIdleProcInfo)
  141. #define CallPItemProc(userRoutine, theDialog, item)             CALL_TWO_PARAMETER_UPP((userRoutine), uppPItemProcInfo, (theDialog), (item))
  142.  
  143. struct TPrPort {
  144.     GrafPort                         gPort;                        /*The Printer's graf port.*/
  145.     QDProcs                         gProcs;                        /*..and its procs*/
  146.     long                             lGParam1;                    /*16 bytes for private parameter storage.*/
  147.     long                             lGParam2;
  148.     long                             lGParam3;
  149.     long                             lGParam4;
  150.     Boolean                         fOurPtr;                    /*Whether the PrPort allocation was done by us.*/
  151.     Boolean                         fOurBits;                    /*Whether the BitMap allocation was done by us.*/
  152. };
  153. typedef struct TPrPort                    TPrPort;
  154.  
  155. typedef TPrPort *                        TPPrPort;
  156. typedef TPPrPort                         TPPrPortRef;
  157. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  158.   This is the "PrPeek" record. */
  159.  
  160. struct TPrInfo {
  161.     short                             iDev;                        /*Font mgr/QuickDraw device code*/
  162.     short                             iVRes;                        /*Resolution of device, in device coordinates*/
  163.     short                             iHRes;                        /*..note: V before H => compatable with Point.*/
  164.     Rect                             rPage;                        /*The page (printable) rectangle in device coordinates.*/
  165. };
  166. typedef struct TPrInfo                    TPrInfo;
  167.  
  168. typedef TPrInfo *                        TPPrInfo;
  169. /* Print Info Record: The parameters needed for page composition. */
  170.  
  171. struct TPrStl {
  172.     short                             wDev;
  173.     short                             iPageV;
  174.     short                             iPageH;
  175.     SInt8                             bPort;
  176.     TFeed                             feed;
  177. };
  178. typedef struct TPrStl                    TPrStl;
  179.  
  180. typedef TPrStl *                        TPPrStl;
  181.  
  182. struct TPrXInfo {
  183.     short                             iRowBytes;
  184.     short                             iBandV;
  185.     short                             iBandH;
  186.     short                             iDevBytes;
  187.     short                             iBands;
  188.     SInt8                             bPatScale;
  189.     SInt8                             bUlThick;
  190.     SInt8                             bUlOffset;
  191.     SInt8                             bUlShadow;
  192.     TScan                             scan;
  193.     SInt8                             bXInfoX;
  194. };
  195. typedef struct TPrXInfo                    TPrXInfo;
  196.  
  197. typedef TPrXInfo *                        TPPrXInfo;
  198.  
  199. struct TPrJob {
  200.     short                             iFstPage;                    /*Page Range.*/
  201.     short                             iLstPage;
  202.     short                             iCopies;                    /*No. copies.*/
  203.     SInt8                             bJDocLoop;                    /*The Doc style: Draft, Spool, .., and ..*/
  204.     Boolean                         fFromUsr;                    /*Printing from an User's App (not PrApp) flag*/
  205.     PrIdleUPP                         pIdleProc;                    /*The Proc called while waiting on IO etc.*/
  206.     StringPtr                         pFileName;                    /*Spool File Name: NIL for default.*/
  207.     short                             iFileVol;                    /*Spool File vol, set to 0 initially*/
  208.     SInt8                             bFileVers;                    /*Spool File version, set to 0 initially*/
  209.     SInt8                             bJobX;                        /*An eXtra byte.*/
  210. };
  211. typedef struct TPrJob                    TPrJob;
  212.  
  213. typedef TPrJob *                        TPPrJob;
  214. /* Print Job: Print "form" for a single print request. */
  215.  
  216. struct TPrint {
  217.     short                             iPrVersion;                    /*(2) Printing software version*/
  218.     TPrInfo                         prInfo;                        /*(14) the PrInfo data associated with the current style.*/
  219.     Rect                             rPaper;                        /*(8) The paper rectangle [offset from rPage]*/
  220.     TPrStl                             prStl;                        /*(8)  This print request's style.*/
  221.     TPrInfo                         prInfoPT;                    /*(14)  Print Time Imaging metrics*/
  222.     TPrXInfo                         prXInfo;                    /*(16)  Print-time (expanded) Print info record.*/
  223.     TPrJob                             prJob;                        /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  224.     short                             printX[19];                    /*Spare to fill to 120 bytes!*/
  225. };
  226. typedef struct TPrint                    TPrint;
  227.  
  228. typedef TPrint *                        TPPrint;
  229. typedef TPPrint *                        THPrint;
  230.  
  231. struct TPrStatus {
  232.     short                             iTotPages;                    /*Total pages in Print File.*/
  233.     short                             iCurPage;                    /*Current page number*/
  234.     short                             iTotCopies;                    /*Total copies requested*/
  235.     short                             iCurCopy;                    /*Current copy number*/
  236.     short                             iTotBands;                    /*Total bands per page.*/
  237.     short                             iCurBand;                    /*Current band number*/
  238.     Boolean                         fPgDirty;                    /*True if current page has been written to.*/
  239.     Boolean                         fImaging;                    /*Set while in band's DrawPic call.*/
  240.     THPrint                         hPrint;                        /*Handle to the active Printer record*/
  241.     TPPrPortRef                     pPrPort;                    /*Ptr to the active PrPort*/
  242.     PicHandle                         hPic;                        /*Handle to the active Picture*/
  243. };
  244. typedef struct TPrStatus                TPrStatus;
  245.  
  246. typedef TPrStatus *                        TPPrStatus;
  247. typedef TPPrStatus                         TPPrStatusRef;
  248.  
  249. /* Print Status: Print information during printing. */
  250.  
  251. struct TPfPgDir {
  252.     short                             iPages;
  253.     long                             iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  254. };
  255. typedef struct TPfPgDir                    TPfPgDir;
  256.  
  257. typedef TPfPgDir *                        TPPfPgDir;
  258. typedef TPPfPgDir *                        THPfPgDir;
  259. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  260. /* This is the Printing Dialog Record. Only used by folks appending their own
  261.    DITLs to the print dialogs.    Print Dialog: The Dialog Stream object. */
  262.  
  263. struct TPrDlg {
  264.     DialogRecord                     Dlg;                        /*The Dialog window*/
  265.     ModalFilterUPP                     pFltrProc;                    /*The Filter Proc.*/
  266.     PItemUPP                         pItemProc;                    /*The Item evaluating proc.*/
  267.     THPrint                         hPrintUsr;                    /*The user's print record.*/
  268.     Boolean                         fDoIt;
  269.     Boolean                         fDone;
  270.     long                             lUser1;                        /*Four longs for apps to hang global data.*/
  271.     long                             lUser2;                        /*Plus more stuff needed by the particular*/
  272.     long                             lUser3;                        /*printing dialog.*/
  273.     long                             lUser4;
  274. };
  275. typedef struct TPrDlg                    TPrDlg;
  276.  
  277. typedef TPrDlg *                        TPPrDlg;
  278. typedef TPrDlg *                        TPPrDlgRef;
  279. typedef CALLBACK_API( TPPrDlgRef , PDlgInitProcPtr )(THPrint hPrint);
  280. typedef STACK_UPP_TYPE(PDlgInitProcPtr)                         PDlgInitUPP;
  281. enum { uppPDlgInitProcInfo = 0x000000F0 };                         /* pascal 4_bytes Func(4_bytes) */
  282. #define NewPDlgInitProc(userRoutine)                             (PDlgInitUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPDlgInitProcInfo, GetCurrentArchitecture())
  283. #define CallPDlgInitProc(userRoutine, hPrint)                     CALL_ONE_PARAMETER_UPP((userRoutine), uppPDlgInitProcInfo, (hPrint))
  284.  
  285. struct TGnlData {
  286.     short                             iOpCode;
  287.     short                             iError;
  288.     long                             lReserved;                    /*more fields here depending on call*/
  289. };
  290. typedef struct TGnlData                    TGnlData;
  291.  
  292. struct TRslRg {
  293.     short                             iMin;
  294.     short                             iMax;
  295. };
  296. typedef struct TRslRg                    TRslRg;
  297.  
  298. struct TRslRec {
  299.     short                             iXRsl;
  300.     short                             iYRsl;
  301. };
  302. typedef struct TRslRec                    TRslRec;
  303.  
  304. struct TGetRslBlk {
  305.     short                             iOpCode;
  306.     short                             iError;
  307.     long                             lReserved;
  308.     short                             iRgType;
  309.     TRslRg                             xRslRg;
  310.     TRslRg                             yRslRg;
  311.     short                             iRslRecCnt;
  312.     TRslRec                         rgRslRec[27];
  313. };
  314. typedef struct TGetRslBlk                TGetRslBlk;
  315.  
  316. struct TSetRslBlk {
  317.     short                             iOpCode;
  318.     short                             iError;
  319.     long                             lReserved;
  320.     THPrint                         hPrint;
  321.     short                             iXRsl;
  322.     short                             iYRsl;
  323. };
  324. typedef struct TSetRslBlk                TSetRslBlk;
  325.  
  326. struct TDftBitsBlk {
  327.     short                             iOpCode;
  328.     short                             iError;
  329.     long                             lReserved;
  330.     THPrint                         hPrint;
  331. };
  332. typedef struct TDftBitsBlk                TDftBitsBlk;
  333.  
  334. struct TGetRotnBlk {
  335.     short                             iOpCode;
  336.     short                             iError;
  337.     long                             lReserved;
  338.     THPrint                         hPrint;
  339.     Boolean                         fLandscape;
  340.     SInt8                             bXtra;
  341. };
  342. typedef struct TGetRotnBlk                TGetRotnBlk;
  343. EXTERN_API( void )
  344. PrPurge                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xA800, 0x0000, 0xA8FD);
  345.  
  346. EXTERN_API( void )
  347. PrNoPurge                        (void)                                                        FOURWORDINLINE(0x2F3C, 0xB000, 0x0000, 0xA8FD);
  348.  
  349. EXTERN_API( void )
  350. PrOpen                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xC800, 0x0000, 0xA8FD);
  351.  
  352. EXTERN_API( void )
  353. PrClose                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xD000, 0x0000, 0xA8FD);
  354.  
  355. EXTERN_API( void )
  356. PrintDefault                    (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x2004, 0x0480, 0xA8FD);
  357.  
  358. EXTERN_API( Boolean )
  359. PrValidate                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x5204, 0x0498, 0xA8FD);
  360.  
  361. EXTERN_API( Boolean )
  362. PrStlDialog                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x2A04, 0x0484, 0xA8FD);
  363.  
  364. EXTERN_API( Boolean )
  365. PrJobDialog                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x3204, 0x0488, 0xA8FD);
  366.  
  367. EXTERN_API( TPPrDlgRef )
  368. PrStlInit                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x3C04, 0x040C, 0xA8FD);
  369.  
  370. EXTERN_API( TPPrDlgRef )
  371. PrJobInit                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x4404, 0x0410, 0xA8FD);
  372.  
  373. EXTERN_API( void )
  374. PrJobMerge                        (THPrint                 hPrintSrc,
  375.                                  THPrint                 hPrintDst)                            FOURWORDINLINE(0x2F3C, 0x5804, 0x089C, 0xA8FD);
  376.  
  377. EXTERN_API( Boolean )
  378. PrDlgMain                        (THPrint                 hPrint,
  379.                                  PDlgInitUPP             pDlgInit)                            FOURWORDINLINE(0x2F3C, 0x4A04, 0x0894, 0xA8FD);
  380.  
  381. EXTERN_API( TPPrPortRef )
  382. PrOpenDoc                        (THPrint                 hPrint,
  383.                                  TPPrPortRef             pPrPort, /* can be NULL */
  384.                                  Ptr                     pIOBuf)                                FOURWORDINLINE(0x2F3C, 0x0400, 0x0C00, 0xA8FD);
  385.  
  386. EXTERN_API( void )
  387. PrCloseDoc                        (TPPrPortRef             pPrPort)                            FOURWORDINLINE(0x2F3C, 0x0800, 0x0484, 0xA8FD);
  388.  
  389. EXTERN_API( void )
  390. PrOpenPage                        (TPPrPortRef             pPrPort,
  391.                                  TPRect                 pPageFrame)                            FOURWORDINLINE(0x2F3C, 0x1000, 0x0808, 0xA8FD);
  392.  
  393. EXTERN_API( void )
  394. PrClosePage                        (TPPrPortRef             pPrPort)                            FOURWORDINLINE(0x2F3C, 0x1800, 0x040C, 0xA8FD);
  395.  
  396. EXTERN_API( void )
  397. PrPicFile                        (THPrint                 hPrint,
  398.                                  TPPrPortRef             pPrPort,
  399.                                  Ptr                     pIOBuf,
  400.                                  Ptr                     pDevBuf,
  401.                                  TPPrStatusRef             prStatus)                            FOURWORDINLINE(0x2F3C, 0x6005, 0x1480, 0xA8FD);
  402.  
  403. EXTERN_API( short )
  404. PrError                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xBA00, 0x0000, 0xA8FD);
  405.  
  406. EXTERN_API( void )
  407. PrSetError                        (short                     iErr)                                FOURWORDINLINE(0x2F3C, 0xC000, 0x0200, 0xA8FD);
  408.  
  409. EXTERN_API( void )
  410. PrGeneral                        (Ptr                     pData)                                FOURWORDINLINE(0x2F3C, 0x7007, 0x0480, 0xA8FD);
  411.  
  412. EXTERN_API( void )
  413. PrDrvrOpen                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x8000, 0x0000, 0xA8FD);
  414.  
  415. EXTERN_API( void )
  416. PrDrvrClose                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x8800, 0x0000, 0xA8FD);
  417.  
  418. EXTERN_API( void )
  419. PrCtlCall                        (short                     iWhichCtl,
  420.                                  long                     lParam1,
  421.                                  long                     lParam2,
  422.                                  long                     lParam3)                            FOURWORDINLINE(0x2F3C, 0xA000, 0x0E00, 0xA8FD);
  423.  
  424. EXTERN_API( Handle )
  425. PrDrvrDCE                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x9400, 0x0000, 0xA8FD);
  426.  
  427. EXTERN_API( short )
  428. PrDrvrVers                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x9A00, 0x0000, 0xA8FD);
  429.  
  430. EXTERN_API( short )
  431. PrLoadDriver                    (void)                                                        FOURWORDINLINE(0x2F3C, 0xD800, 0x0000, 0xA8FD);
  432.  
  433.  
  434.  
  435. #if PRAGMA_STRUCT_ALIGN
  436.     #pragma options align=reset
  437. #elif PRAGMA_STRUCT_PACKPUSH
  438.     #pragma pack(pop)
  439. #elif PRAGMA_STRUCT_PACK
  440.     #pragma pack()
  441. #endif
  442.  
  443. #ifdef PRAGMA_IMPORT_OFF
  444. #pragma import off
  445. #elif PRAGMA_IMPORT
  446. #pragma import reset
  447. #endif
  448.  
  449. #ifdef __cplusplus
  450. }
  451. #endif
  452.  
  453. #endif /* __PRINTING__ */
  454.  
  455.